package com.institute.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.institute.entity.Institute;
import com.institute.entity.Position;
import com.staff.entity.Staff;

@Repository
public interface PositionRepository extends PagingAndSortingRepository<Position,Long>,JpaSpecificationExecutor<Position>{
	@Query(value="from Staff s where s.position.id = ?1")
	public List<Staff> findStaffsByPosition(Long id);
	@Query(value="from Position p where p.dept.name = ?1")
	public List<Position> findByDeptName(String name);
	@Query(value="from Position p where p.name = ?1")
	public Position findByName(String name);
}
